<script lang="ts"  setup>
import {hello} from "@/api/article.js";
import {ref} from "vue";
import {Delete, Edit,} from '@element-plus/icons-vue'

const formInline = ref({
  user: '',
  region: '',
  date: '',
})

const onSubmit = () => {
  console.log('submit!')
}
const currentPage4 = ref(2)
const pageSize4 = ref(10)
const small = ref(false)
const background = ref(false)
const disabled = ref(false)
const total=ref(20)
const handleSizeChange = (val: number) => {
  console.log(`${val} items per page`)
}
const handleCurrentChange = (val: number) => {
  console.log(`current page: ${val}`)
}
const tableData = [
  {
    date: '2016-05-03',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-02',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-04',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-01',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
]


</script>

<template>
  <el-card class="box-card">
      <div class="card-header">
        <span>文章管理</span>
       <el-button type="primary">发布</el-button>
      </div>
    <div>
      <hr>
    </div>
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="Approved by">
        <el-input v-model="formInline.user" placeholder="Approved by" clearable />
      </el-form-item>
      <el-form-item label="Activity zone">
        <el-select
            v-model="formInline.region"
            placeholder="Activity zone"
            clearable
        >
          <el-option label="Zone one" value="shanghai" />
          <el-option label="Zone two" value="beijing" />
        </el-select>
      </el-form-item>
      <el-form-item label="Activity time">
        <el-date-picker
            v-model="formInline.date"
            type="date"
            placeholder="Pick a date"
            clearable
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
        <el-button type="primary" @click="onSubmit">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="name" label="文章标题"  />
      <el-table-column prop="date" label="文章创建时间"  />
      <el-table-column prop="address" label="Address" />
      <el-table-column prop="address" label="操作" >
        <el-button type="primary" :icon="Edit" circle />
        <el-button type="danger" :icon="Delete" circle />
      </el-table-column>
    </el-table>
    <el-pagination
        class="el-p"
        v-model:current-page="currentPage4"
        v-model:page-size="pageSize4"
        :page-sizes="[10, 50, 200]"
        :small="small"
        :disabled="disabled"
        :background="background"
        layout="total,  prev, pager, next, jumper, sizes"
        :total="total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
    />
  </el-card>

</template>


<style scoped>
.el-p{
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}
.demo-form-inline .el-select {
  --el-select-width: 220px;
}
.demo-form-inline .el-input {
  --el-input-width: 220px;
}
.card-header{
  display: flex;
  justify-content: space-between;
}
</style>
